package EveryDayPractice;

import java.util.ArrayList;
import java.util.Scanner;

public class Practice37 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("有多少个人转圈");
        int n = sc.nextInt();
        int x=3;
        int index=0;
        ArrayList<Integer> list = new ArrayList<Integer>();
        for (int i = 1; i <= n; i++) {
            list.add(i);
        }
        while(list.size()>1) {
          index=(index+x-1)%list.size();
                list.remove(index);
        }
        System.out.println(list.get(0)+"号留下来了");
    }
}
